package com.quanyue.music.order.mapper;

import com.quanyue.music.domain.entity.InvitationCode;
import com.shzisg.mybatis.mapper.auto.AutoMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface CodeMapper extends AutoMapper <InvitationCode> {

    InvitationCode findValid(@Param("code") String code);

    @Update("update qy_user set inside_user = true where id = #{userId}")
    void updateUser(@Param("userId") String userId);

    @Select("select * from qy_invitation_code where del_flag = 0 order by create_time desc")
    List <InvitationCode> findTotalValid();
}
